import { User } from "../models";

// 获取用户信息
export const getUserById = async (id: number, attributes?: string[], checkExist = false) => {
  const user = await User.findById(id, attributes);
  if (!user && checkExist) {
    throw new Error("USER_NOT_FOUND");
  }
  return user;
};
